using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CelliItemView : MonoBehaviour
{
    public CellData _CellData;
    private Image image;
    private Text lable;
    private Text id;
    private Text index;
    
    private void Awake()
    {
        image = transform.Find("Image").GetComponent<Image>();
        lable = transform.Find("Num").GetComponent<Text>();
        id = transform.Find("Id").GetComponent<Text>();
        index = transform.Find("Text1").GetComponent<Text>();
        
    }


    public void SetData(CellData _CellData)
    {
        this._CellData = _CellData;
        if (this._CellData==null)
        { 
            return;
        }
 
        
        lable.text = this._CellData.Num.ToString();
        id.text = this._CellData.ID.ToString();
        index.text = this._CellData.Index.ToString();
        image.sprite = this._CellData.ISprite;
    }

}

[Serializable]
public class CellData
{
    public int ID;
    public int Num;
    public int CellType;
    public int Index;
    public Vector3 LocalPos;
    public Sprite ISprite;

    public CellData()
    {
    }

    public CellData(int _ID, int _Type, int _Num, Sprite _sprite)
    {
        ID = _ID;
        Num = _Num;
        CellType = _Type;
        ISprite = _sprite;
        Index = 0;
        LocalPos = Vector3.zero;
    }

    public CellData(int _ID, int _Type, int _Num, Sprite _sprite, int _Index, Vector3 _LocalPos)
    {
        ID = _ID;
        Num = _Num;
        CellType = _Type;
        Index = _Index;
        LocalPos = _LocalPos;
        ISprite = _sprite;
    }
}